import http from '@/plugins/http/index';
/*

 lesson相关的接口

*/

/**课程
 *
 */
//多条件查询课程
export const selectLessonByName = params => {
	return http.post(`/lt-order/wechat/logonless/select_lesson_byname_page.do`, params);
};

// 根据Id查询课程详情a
export const selectLessonById = params => {
	return http.get(`/lt-order/wxLessonInfo/logonless/selelctLessonInfo.do`, params).then(res => res);
};
// 学员动态
export const getStudentBehavior = params => {
	return http.get(`/lt-order/logonless/query_student_dynamics.do`, {
		data: params,
	});
};

// 根据Id查询课程目录
export const selectLessonMenuById = params => {
	return http.get(`/lt-order/logonless/select_PcSubLesson_byLessonId.do`, params).then(res => res);
};

//单个分节课程视频查询
export const selectSubLessonById = params => {
	return http.get(`/lt-order/select_subLesson_video.do`, params).then(res => res);
};

// export const selectSubLessonById = params => {
//   return http(`/lt-order/select_wxsubLesson_video.do`, params, { method: 'GET' }).then(res => res);
// };

//微信端查询用户评价平均等级评分
export const selectAverageScoreById = params => {
	return http.get(`/lt-order/logonless/selectAverageScore.do`, params).then(res => res);
};
//微信端分页查询用户评价
export const selectCommentsByPage = params => {
	return http.post(`/lt-order/wechat/logonless/selectLessonCommentByPage.do`, params).then(res => res);
};
//收藏课程以及取消收藏
export const collectLesson = params => {
	return http(`/lt-order/collect_lesson.do`, params, {
		method: 'GET',
	}).then(res => res);
};
//点赞
export const getLessonLiked = params => {
	return http(`/lt-order/get_like_lesson.do`, params, {
		method: 'GET',
	}).then(res => res);
};
//根据分节课程id查询视频信息(首页免费的)
export const selectVideoForFree = params => {
	return http(`/lt-order/logonless/select_subLesson_free_video.do`, params, {
		method: 'GET',
	}).then(res => res);
};
//根据分节课程id查询视频信息 需要鉴权的
export const selectVideoForAuth = params => {
	return http.get(`/lt-order/select_subLesson_video.do`, params).then(res => res);
};

// export const selectVideoForFree = params => {
//   return http(`/lt-order/logonless/select_subLesson_wxfree_video.do`, params,{method:'GET'}).then(res => res);
// };

//查询专家推荐课程
export const selectProfessorLessons = params => {
	return http.get(`/lt-order/wechat/logonless/selectProfessorRecoLessons.do`, params);
};
//根据videoId获取playauth
export const selectVideoAuth = params => {
	return http(`/lt-order/logonless/select_video_token.do`, params, {
		method: 'GET',
	}).then(res => res);
};
//微信端用户点赞
export const addCommentLike = params => {
	return http(`/lt-order/wechat/addCommentLike.do`, params, {
		method: 'GET',
	}).then(res => res);
};
//微信端用户新建评价
export const addLessonComment = params => {
	return http.post(`/lt-order/wechat/addLessonComment.do`, params).then(res => res);
};

//入口判断产品相关信息targetType 1.课程 2.会员 3.专属不调用该接口
export const payLessonInfo = params => {
	return http(`/lt-order/payLessonInfo.do`, params, {
		method: 'GET',
	}).then(res => res);
};
//下单
export const addOrder = params => {
	return http(`/lt-order/addOrder.do`, params).then(res => res);
};
//微信支付
export const wechatPay = params => {
	return http(`/yjz-pay/lawtrain/wechatPay.do`, params).then(res => res);
};
//激活码激活
export const codeOrder = params => {
	return http(`/lt-order/codeOrder.do`, params).then(res => res);
};
// 推荐课程
export const getTeacherRecommend = params => {
	return http.get(`/lt-order/logonless/query_lecturer_recommend.do`, params);
};

// 课程详情页相关课程
export const getRecommendLesson = params => {
	return http.get(`/lt-order/logonless/select_reco_lessons.do`, params).then(res => res);
};
